using System;
using System.Collections.Generic;
using PluginFrame;

namespace PcrDataStructure
{
    [Serializable]
    public class PcrModule : IPcrModule
    {
        private string mModuleID;

        private bool mIsAvailable;

        private List<ISubModule> mSubModules = new List<ISubModule>();

        private IPcrStructure mPcrStructure;

        private bool mIsUseHotLid;

        private double mHotLidTemperature;

        private List<double> mHotlidTemperature;

        public List<double> HotlidTemperature
        {
            get
            {
                return mHotlidTemperature;
            }
        }

        List<ISubModule> IPcrModule.SubModules
        {
            get
            {
                return mSubModules;
            }
            set
            {
                mSubModules = value;
            }
        }

        bool IPcrModule.UseHotlid
        {
            get
            {
                return mIsUseHotLid;
            }
            set
            {
                mIsUseHotLid = value;
            }
        }

        double IPcrModule.HotLidTemperaure
        {
            get
            {
                return mHotLidTemperature;
            }
            set
            {
                mHotLidTemperature = value;
            }
        }

        IPcrStructure IPcrModule.PcrStructure
        {
            get
            {
                return mPcrStructure;
            }
        }

        string IPcrModule.ModuleID
        {
            get
            {
                return mModuleID;
            }
            set
            {
                mModuleID = value;
            }
        }

        public bool CanbeUsed
        {
            get
            {
                return mIsAvailable;
            }
            set
            {
                mIsAvailable = value;
            }
        }

        public PcrModule(IPcrStructure pcrStructure)
        {
            mPcrStructure = pcrStructure;
            mIsAvailable = true;
            mHotlidTemperature = new List<double>();
        }

        public void AddHotlidTemperature(double hotlidTemperature)
        {
            mHotlidTemperature.Add(hotlidTemperature);
        }

        public double GetHotlidTemperature(int index)
        {
            return mHotlidTemperature[index];
        }

        public int GetModuleIndex()
        {
            return mModuleID.ToCharArray()[0] - 65;
        }
    }
}
